package Fastloadnet;

use WWW::Mechanize;

sub upload
{
	my $local_file = shift;
	my $hoster_config = shift;
    
	my $mech = WWW::Mechanize->new();

	$textbox_content =  "ftp://".$::spreader_ftp_user.":".$::spreader_ftp_pwd."\@".$::spreader_ftp_ip.$::spreader_ftp_path.$local_file."\n";
	
	$mech->get("http://www.fast-load.net/");

	$mech->form_number(1);
	$mech->field("user" => $hoster_config->{'username'});
	$mech->field("password" => $hoster_config->{'password'});
	$mech->field("remote" => $textbox_content);
	$mech->submit();

	my @content = $mech->content;
	foreach (@content) {
		if ($_ =~ /http:\/\/www.fast-load.net\/index.php\?pid=([^&"\n\r<]*)/) {
			return "http://www.fast-load.net/index.php?pid=$1";
		}
	}
}
1;